package com.tx.review.string_;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ：tx
 * @version:
 */
public class InternDemo {
    public static void main(String[] args) throws IOException {
        List<String> address = new ArrayList<>();

        File file = new File("src/main/resources/hello.txt");

        System.in.read();
        for (int i = 0; i < 10; i++) {
            try (BufferedReader reader = new BufferedReader(new FileReader(file)) ) {
                String line = null;
                long start = System.nanoTime();
                while (true) {
                    line = reader.readLine();
                    if(line == null) {
                        break;
                    }
//                    address.add(line);
                    address.add(line.intern());
                }
                System.out.println("cost:" +(System.nanoTime()-start)/1000000);
            }
        }
        System.in.read();
    }
}
